package com.cyj.securitydemo1.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {
    @GetMapping("/hello")
    public String test() {
        return "hello security";
    }

    @GetMapping("/index")
    public String index() {
        return "hello index";
    }

    @GetMapping("/update")
//    @Secured(value = {"ROLE_admins","ROLE_sale"}) //角色
//    @PreAuthorize("hasAnyAuthority('admins')")  //权限，方法之前
//    @PostAuthorize() //方法之后校验
    public String update() {
        return "hello update";
    }
}
